<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
  <caption>个人信息</caption>
  <tr><td>照片：</td><td id="head-id"></td></tr>
  <tr><td>姓名：</td><td id="name-id"></td></tr>
  <tr><td>年龄：</td><td id="age-id"></td></tr>
  <tr><td>好友：</td ><td id="friend-id"></td></tr>
</table>
<input type="button" value="请求数据" onclick="f()">
<script>
    let head = document.querySelector("#head-id");
    let name = document.querySelector("#name-id");
    let age = document.querySelector("#age-id");
    let friends = document.querySelector("#friend-id");
    function f() {
     let person = {namee:"吕布",agee:28,url:"a.png",frends:["貂蝉","刘备","李信"]};
        console.log("OK");
        //将名字和年龄加入表格
     name.innerText = person.namee;
     age.innerText = person.agee;
     //将图片加入列表中
     let  img = document.createElement("img");
     img.src = person.url;
     head.append(img);
     //将好友以无序列表的形式加入列表中
     let ul = document.createElement("ul");
        for (let frend of person.frends) {
            let li = document.createElement("li");
            li.innerText=frend;
            ul.append(li);
        }

        friends.append(ul);
    }
</script>


</body>
</html>